/* 全局重置和基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

/* 应用容器 */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  margin: 0 auto;
  background-color: white;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* 头部样式 */
.app-header {
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  color: white;
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}

/* 模式切换按钮 */
.mode-switch {
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px;
  border-radius: 6px;
}

.mode-button {
  padding: 8px 20px;
  background: transparent;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.mode-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.mode-button.active {
  background: white;
  color: #1976d2;
  font-weight: 600;
}

/* 工具栏区域 */
.toolbars-section {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #dee2e6;
}

/* 主要内容区域 */
.main-content {
  flex: 1;
  display: flex;
  gap: 20px;
  padding: 20px;
  min-height: 600px;
}

/* 编辑器区域 */
.editor-section {
  flex: 1;
  min-height: 400px;
}

/* 预览区域 */
.preview-section {
  width: 400px;
  min-width: 300px;
}

/* 底部状态信息 */
.app-footer {
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.status-info {
  display: flex;
  gap: 20px;
  align-items: center;
}

.formula-status {
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
}

.formula-status.valid {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.formula-status.invalid {
  background-color: #ffebee;
  color: #c62828;
}

.latex-length {
  color: #6c757d;
}

/* 错误信息 */
.error-info {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.error-message {
  background-color: #ffebee;
  color: #c62828;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .main-content {
    flex-direction: column;
  }
  
  .preview-section {
    width: 100%;
    min-height: 300px;
  }
}

@media (max-width: 768px) {
  .app-container {
    box-shadow: none;
  }
  
  .app-header {
    flex-direction: column;
    gap: 15px;
    padding: 15px 20px;
    text-align: center;
  }
  
  .app-header h1 {
    font-size: 20px;
  }
  
  .main-content {
    padding: 15px;
    gap: 15px;
  }
  
  .app-footer {
    flex-direction: column;
    gap: 10px;
    padding: 10px 15px;
    text-align: center;
  }
  
  .status-info {
    flex-direction: column;
    gap: 10px;
  }
  
  .error-info {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .mode-button {
    padding: 6px 15px;
    font-size: 13px;
  }
  
  .main-content {
    padding: 10px;
  }
}

/* 全局链接样式 */
a {
  color: #1976d2;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* 全局按钮样式重置 */
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* 全局输入框样式重置 */
input, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* 滚动条全局样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* 选中文本样式 */
::selection {
  background-color: rgba(25, 118, 210, 0.2);
  color: inherit;
}

::-moz-selection {
  background-color: rgba(25, 118, 210, 0.2);
  color: inherit;
}

/* 加载动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main-content > section {
  animation: fadeIn 0.3s ease-out;
}
